#ifndef BASEHTTPCLIENT_INCLUDED
#define BASEHTTPCLIENT_INCLUDED

#include "base.h"
#include "BaseTcp.h"
#include "BaseHTTPClientSession.h"

class BASE_API BaseHttpClient:public BaseConnector,public BaseHTTPClientSession
{
public:
	BaseHttpClient(Proactor* proactor,char* remoteip=NULL,unsigned short remoteport=BaseHTTPSession::HTTP_PORT);
	BaseHttpClient(Proactor* proactor,const string &url);
	~BaseHttpClient(void);
protected:
	virtual pj_bool_t OnDataRead(void *data,pj_size_t size,int status,pj_size_t* remainder);
	virtual pj_bool_t OnDataSend(pj_ioqueue_op_key_t *send_key,int sendsize);
	virtual pj_bool_t OnConnect(int status);
protected:
	////subclass implement below virtual method
    //virtual void OnReply(int status,BaseHTTPResponse& reply){};
public:
	int  sendGetRequest(string& url,string& body);
	int  sendPostRequest(string& url,string& body);
	int  sendPutRequest(string& url,string& body);
	int  sendDeleteRequest(string& url,string& body);
};

#endif
